package br.mikhas.lab.scanner;

public class Token {

	private final String tokenType;
	private final CharStream stream;
	private final int start;
	private final int end;

	Token(String tokenType, CharStream stream, int start, int end) {
		this.tokenType = tokenType;
		this.stream = stream;
		this.start = start;
		this.end = end;
	}

	public String getText() {
		return stream.getSection(start, end);
	}

	public String getTokenType() {
		return tokenType;
	}

	@Override
	public String toString() {
		return this.tokenType + ":" + getText();
	}
}
